package com.fhao.spring.selfblog.mapper;

import com.fhao.spring.selfblog.model.BlogInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BlogInfoMapper {
    //获取所有博客列表
    @Select("select * from blog where delete_flag = 0")
    List<BlogInfo> selectAll();

    //根据博客id 查询博客信息
    @Select("select * from blog where id = #{id} and delete_flag = 0")
    BlogInfo selectById(Integer id);

    //根据博客id
    Integer updateBlog(BlogInfo blogInfo);

    //插入新的博客数据
    @Insert("insert into blog (title,content,user_id) values (#{title},#{content},#{userId})")
    Integer insertBlog(BlogInfo blogInfo);
}



















